//
//  MineCollectionCell.m
//  BakeCenter
//
//  Created by Barnett Wu on 15/9/22.
//  Copyright (c) 2015年 Baked. All rights reserved.
//

#import "MineCollectionCell.h"

@implementation MineCollectionCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIImageView *backgroundPicture = [[UIImageView alloc]init];
        
        backgroundPicture.backgroundColor = [UIColor creamColor];
        [self.contentView addSubview:backgroundPicture];
        
        [backgroundPicture mas_makeConstraints:^(MASConstraintMaker *make) {
         
            make.left.equalTo(self.mas_left).offset(10);
            make.right.equalTo(self.mas_right).offset(- 5);
            make.top.equalTo(self.mas_top).offset(10);
            make.bottom.equalTo(self.mas_bottom).offset(- 5);
            
        }];
        
        self.heartImage = [[UIImageView alloc] init];
        self.heartImage.backgroundColor = [UIColor clearColor];
        self.heartImage.image = [UIImage imageNamed:@"收藏心.ico"];
        self.heartImage.tintColor = [UIColor easterPinkColor];
        [self.heartImage setUserInteractionEnabled:YES];
        [self.contentView addSubview:self.heartImage];
        
        [self.heartImage mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.right.equalTo(backgroundPicture.mas_right).offset(-10);
            make.top.equalTo(backgroundPicture.mas_top).offset(10);
            make.width.equalTo(@20);
            make.height.equalTo(@20);
            
        }];
        
        UIImageView *userNameImageView = [[UIImageView alloc] init];
        userNameImageView.image = [UIImage imageNamed:@"mineImage"];
        [self addSubview:userNameImageView];
        
        UILabel *userNameLabel = [[UILabel alloc] init];
        userNameLabel.backgroundColor = [UIColor salmonColor];
        [self addSubview:userNameLabel];
        
        UILabel *lineLabel = [[UILabel alloc]init];
        lineLabel.backgroundColor = [UIColor salmonColor];
        [self addSubview:lineLabel];
        
        UILabel *pastryTitle = [[UILabel alloc]init];
        pastryTitle.backgroundColor = [UIColor babyBlueColor];
        [self addSubview:pastryTitle];
        
        UILabel *introductionLabel = [[UILabel alloc]init];
        introductionLabel.backgroundColor = [UIColor babyBlueColor];
        [self addSubview:introductionLabel];
        
        [introductionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.equalTo(@15);
            make.bottom.equalTo(backgroundPicture.mas_bottom).offset(- 5);
            make.left.equalTo(backgroundPicture.mas_left).offset(15);
            make.right.equalTo(backgroundPicture.mas_right).offset(- 15);
        }];
        
        [pastryTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(introductionLabel.mas_top).offset(- 5);
//            make.top.equalTo(lineLabel.mas_bottom).offset(5);
            make.left.equalTo(introductionLabel);
            make.width.equalTo(@120);
            make.height.equalTo(@30);
        }];
        
        [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(pastryTitle.mas_top).offset(- 5);
            make.left.equalTo(introductionLabel);
            make.width.equalTo(introductionLabel);
            make.height.equalTo(@1.8);
        }];
        
        [userNameImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(lineLabel.mas_top).offset(- 5);
            make.left.equalTo(introductionLabel);
            make.width.equalTo(@23);
            make.height.equalTo(@23);
        }];
        
        [userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(userNameImageView);
            make.width.equalTo(@200);
            make.height.equalTo(@25);
            make.left.equalTo(userNameImageView.mas_right).offset(5);
            
        }];
        
        
    }
    return self;
}



- (void)awakeFromNib {
   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
   
    [super setSelected:selected animated:animated];

}

@end
